(deftemplate number (slot parteIntreaga)(slot parteZecimala))
(assert (number(parteIntreaga 1)(parteZecimala 0)))
(assert (number(parteIntreaga 8)(parteZecimala 3)))
(assert (number(parteIntreaga 4)(parteZecimala 6)))
(assert (number(parteIntreaga 9)(parteZecimala 4)))
(assert (number(parteIntreaga 2)(parteZecimala 12345)))

(deftemplate suma (slot parteIntreaga) (slot parteZecimala))
(assert (suma(parteIntreaga 0) (parteZecimala 0)))

(defrule print
    (number (parteIntreaga ?i) (parteZecimala ?f))
    =>
    (printout t "numarul are partea intreaga " ?i " si partea zecimala" ?f crlf)
    )
(defrule adunaIntreg
    ?idnumber<-(number(parteIntreaga ?i))
    ?idnumber2<-(number (parteZecimala ?f))
    ?idfapt<-(suma(parteIntreaga ?s))
    =>
    (retract ?idnumber)
    (bind ?s1 (+ ?s ?i))
    (modify ?idfapt (parteIntreaga ?s1))
    )
(defrule print1
 (suma (parteIntreaga ?s))
    =>
    (printout t "suma este " ?s)   
)
(run)